package com.leetcode.LC;

import java.util.Arrays;

public class LC283 {
    public void moveZeroes(int[] nums) {

        int count=0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i]==0){
                count++;
                continue;
            }
            nums[i-count]=nums[i];
        }
        Arrays.fill(nums,nums.length-count,nums.length,0);

        for (int num : nums) {
            System.out.print(num+",");
        }
    }

    public static void main(String[] args) {
        new LC283().moveZeroes(new int[]{0,1,0,3,12});
    }
}
